(1) Field of the Invention
The present invention relates to a reload-timer/counter circuit which is mounted in a peripheral unit formed inside a one-chip microcontroller.
In recent years, one-chip microcontrollers have been increasingly manufactured, which one-chip microcontrollers contain therein a central processing unit (CPU), A read-only memory (ROM), a random-access memory (RAM), a peripheral unit therefor and so on in the form of a single chip.
As known, a reload-timer is comprised of a counter for counting an internal clock to produce a timer interrupt when the count value reaches a predetermined value. On the other hand, a counter works as a so-called event counter which counts an external clock and, when the count value overflows, a certain flag is set in a related status register.
Although the reload-timer and the counter have no particular relation therebetween, both the reload-timer and the counter are generally located close to each other in the peripheral unit of the one-chip microcontroller to form a reload-timer/counter circuit.
2. Description of the Related Art
As mentioned above, the reload-timer/counter circuit provides two major functions, i.e., a timer function and a counter function therefore, as understood later, it is necessary for the circuit to comprise at least six independent registers to construct the same. However, too many registers cannot satisfy a recent demand for reduction of the number of logic gates and also reduction of cost per each function, due to miniaturization of the one-chip controller.
In actuality, however, it is not easy to satisfy the above mentioned demand due to the nature of a reload-timer/counter circuit. That is, in accordance with the made of operation required by a user, in one case, only the counter function is needed, and in an other case, only the timer function is needed. Thus, either one of the counter function or the timer function is not needed by certain users. Nevertheless, the related circuit is usually so designed as to provide both the timer function and the counter function simultaneously. This means that the reload-timer/counter circuit necessarily contains unused register parts comprising the timer or the counter, and the related logic gate parts which are not needed by the user. Thus, a problem arises that such unused register and logic gate parts increase manufacturing costs for each function and also limit availability for general purpose use.